<!DOCTYPE html>
<#assign base=req.contextPath />
<html>
	<head>
		<base id="base" href="${base}">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>2018夏令营活动_中小学夏令营_游学夏令营_军事夏令营_暑假夏令营</title>
		<meta name="keywords" content="夏令营,暑期夏令营,中小学夏令营,军事夏令营,青少年夏令营,夏令营活动" />
		<meta name="description" content="快乐夏令营【官网】2018夏令营活动：国内夏令营,英语夏令营,军事夏令营,海外游学夏令营,暑假夏令营,中小学夏令营,青少年夏令营。北京,上海,广州,深圳,杭州,武汉,成都,重庆等城市夏令营。" />
		<link rel="stylesheet" type="text/css" href="${base}/css/common.css" />
		<link rel="stylesheet" type="text/css" href="${base}/css/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="${base}/css/jquery.validator.css" />
		<link rel="stylesheet" type="text/css" href="${base}/css/register.css">
		<script type="text/javascript" src="${base}/js/modules/sys/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="${base}/js/common.js"></script>
        <script type="text/javascript" src="${base}/js/modules/sys/jquery.validator.js"></script>
	</head>
    <body>

		<!-- 头顶部结构start -->
		<form id="register" class="zy_validator">
			<div class="zy_f_item">
				<div class="zy_f_item_i clearfix">
					<div class="zy_f_lable">密码：</div>
					<input class="zy_f_info" type="password" name="psw">
				</div>
			</div>
			<div class="zy_f_item">
				<div class="zy_f_item_i clearfix">
					<div class="zy_f_lable">确认密码：</div>
					<input class="zy_f_info" type="password" name="confirm_psw">
				</div>
			</div>
			<div class="zy_f_item">
				<div class="zy_f_item_i clearfix">
					<div class="zy_f_lable">手机号码：</div>
					<input class="zy_f_info" type="text" name="phone">
				</div>
			</div>
			<div class="zy_f_item">
				<div class="zy_f_item_i clearfix">
					<div class="zy_f_lable">验证码：</div>
					<input class="zy_f_info" type="text" name="_vcode">
					<img class="zy_f_pic" id="zy_f_pic" src="https://user.xialingying.cc/util/vcode?_vkey=f9bff41227bc3ced450cba66c90c32d1" alt="">
				</div>
			</div>
			<div class="zy_f_item">
				<div class="zy_f_item_i clearfix">
					<div class="zy_f_lable">手机验证码：</div>
					<input class="zy_f_info" type="text" name="code">
					<div class="zy_f_code" id="zy_f_code">获取验证码</div>
				</div>
			</div>
			<div class="zy_f_item">
				<input class="zy_f_btn" id="zy_f_btn" type="submit" value="submit">
			</div>	
		</form>
		<!-- 头顶部结构end -->

		<!-- 导航定位结构start -->
		
		<!-- 导航定位结构end -->

		<!-- 右侧边栏结构start -->
		
		<!-- 右侧边栏结构end -->

    </body>
</html>
<script>
	$(function () {
		
		var register = $('#register');
		var zyFCode = $("#zy_f_code");
		var href = "https://www.xialingying.cc/";        
		var v = $('#register').validator({
			showOk:'',
			//stopOnError: true,
			onfocusout: true,
			timely: true,
			theme:'register',
			rules:{
				passwordt: function(element, param, field) {
					var weakPwds = ["123456", "123456789", "111111", "5201314",
						"12345678", "123123", "password", "1314520", "123321",
						"7758521", "1234567", "5211314", "666666", "520520",
						"woaini", "520131", "11111111", "888888", "hotmail.com",
						"112233", "123654", "654321", "1234567890", "a123456",
						"88888888", "163.com", "000000", "yahoo.com.cn", "sohu.com",
						"yahoo.cn", "111222tianya", "163.COM", "tom.com", "139.com",
						"wangyut2", "pp.com", "yahoo.com", "147258369", "123123123",
						"147258", "987654321", "100200", "zxcvbnm", "123456a",
						"521521", "7758258", "111222", "110110", "1314521",
						"11111111", "12345678", "a321654", "111111", "123123",
						"5201314", "00000000", "q123456", "123123123", "aaaaaa",
						"a123456789", "qq123456", "11112222", "woaini1314",
						"a123123", "a111111", "123321", "a5201314", "z123456",
						"liuchang", "a000000", "1314520", "asd123", "88888888",
						"1234567890", "7758521", "1234567", "woaini520",
						"147258369", "123456789a", "woaini123", "q1q1q1q1",
						"a12345678", "qwe123", "123456q", "121212", "asdasd",
						"999999", "1111111", "123698745", "137900", "159357",
						"iloveyou", "222222", "31415926", "123456", "111111",
						"123456789", "123123", "9958123", "woaini521", "5201314",
						"18n28n24a5", "abc123", "password", "123qwe", "123456789",
						"12345678", "11111111", "dearbook", "00000000", "123123123",
						"1234567890", "88888888", "111111111", "147258369",
						"987654321", "aaaaaaaa", "1111111111", "66666666",
						"a123456789", "11223344", "1qaz2wsx", "xiazhili",
						"789456123", "password", "87654321", "qqqqqqqq",
						"000000000", "qwertyuiop", "qq123456", "iloveyou",
						"31415926", "12344321", "0000000000", "asdfghjkl",
						"1q2w3e4r", "123456abc", "0123456789", "123654789",
						"12121212", "qazwsxedc", "abcd1234", "12341234",
						"110110110", "asdasdasd", "123456", "22222222", "123321123",
						"abc123456", "a12345678", "123456123", "a1234567",
						"1234qwer", "qwertyui", "123456789a", "qq.com", "369369",
						"163.com", "ohwe1zvq", "xiekai1121", "19860210", "1984130",
						"81251310", "502058", "162534", "690929", "601445",
						"1814325", "as1230", "zz123456", "280213676", "198773",
						"4861111", "328658", "19890608", "198428", "880126",
						"6516415", "111213", "195561", "780525", "6586123",
						"caonima99", "168816", "123654987", "qq776491",
						"hahabaobao", "198541", "540707", "leqing123", "5403693",
						"123456", "123456789", "111111", "5201314", "123123",
						"12345678", "1314520", "123321", "7758521", "1234567",
						"5211314", "520520", "woaini", "520131", "666666",
						"RAND#a#8", "hotmail.com", "112233", "123654", "888888",
						"654321", "1234567890", "a123456"
					];    
					if ($.inArray(element.value, weakPwds) !== -1) {
						return false || '有被盗风险,建议使用字母、数字和符号两种及以上组合';
					}else{
						return (/^(?![A-Z]+$)(?![a-z]+$)(?!\d+$)(?![\W_]+$)\S+$/.test(element.value))?true:false || '有被盗风险,建议使用字母、数字和符号两种及以上组合';
					}
				},
				match: function(element, param, field){
					console.log(element, param, field)
					console.log(arguments[1])
					var pwd = $($(this)[0].$el[0]).find("input[name='"+param+"']").val();
					if(pwd==element.value){
						return true;
					}else{
						return false||'输入的密码请保持一致';
					}
				},
				mobile: function(element, param, field) {
					if (/^1[3|4|5|7|8][0-9]{9}$/.test(element.value)) {
						return true;
					}else{
						return false||'请输入有效的手机号';
					}
				},
				graphical: function(element, param, field) {
					if (/^[0-9a-zA-z]{4}$/.test(element.value)) {
						return true;
					}else{
						return false||'请正确输入图像验证码';
					}
				},
				digits: function(element, param, field) {
					if (/^[0-9]{4}$/.test(element.value)) {
						return true;
					}else{
						return false||'请正确输入手机验证码';
					}
				},
			},
			fields: {
				'psw': {
					rule:'required;password;passwordt;',
					tip: "建议使用字母、数字和符号两种及以上的组合，6-16个字符",
					msg:{
						required:'请输入密码'
					}
				},
				'confirm_psw':{    
					rule:"required;match(psw);",
					tip:"请再次输入密码",
					msg:{
						required:'请再次输入密码',
						//match:'两处密码请保持一致'
					}
				},
				'phone':{
					rule: 'required;mobile;',
					tip:'完成验证后，可以使用该手机登录和找回密码',
					msg:{
						required:'请输入手机号',
					}
				},
				'_vcode':{
					rule:"required;graphical;",
					tip:'看不清？点击图片更换验证码',
					showOk: false,                            
					msg:{
						required:'请输入图片验证码'
					}
				},
				'code':{
					rule:"required;digits;",
					showOk: false,
					msg:{
						required:'请输入手机验证码',
						//digits:'手机验证码不正确'
					}
				},
				// 'checked':{
				// 	rule:"checked",
				// 	showOk: false,
				// 	msg:{
				// 		checked:'请同意并勾选'
				// 	}
				// }
			},
			valid:function(){
				var me = this;
				me.holdSubmit();
				// $.ajax({
				// 	url: "/accounts/_register_v2",
				// 	data: register.serialize(),
				// 	type: "post",
				// 	dataType: "json",
				// 	cache:false,
				// 	success: function (data) {     
				// 		me.holdSubmit(false);
				// 		if(data.err != 'kungfu.ok'){
				// 			switch(data.err) {    
				// 				case 'hapn.u_tcode':
				// 					alert('页面超时，请刷新后重新提交');
				// 					location.reload();
				// 					break;
				// 				default: 
				// 					alert(data.err);
				// 					location.reload();
				// 					break;
				// 			}                                                    
				// 			return;
				// 		}
				// 		var status = data.data.status;
				// 		if (status != 'ok') {
				// 			switch(status) {                              
				// 				case 'phone_error':
				// 					break;  
				// 				case 'sms_code_failed':
				// 					tip('手机验证码过期或错误','code');
				// 					break;
				// 				case 'pwd_error':
				// 					break;
				// 				case 'pwd_diff':
				// 					break; 
				// 				case 'no_check':
				// 					break;                                                         
				// 				default: 
				// 					alert(status);
				// 					break;
				// 			}                                                                   
				// 		} else {
				// 			location.href= href;
				// 		}
				// 	}
				// });                        
			}
		}).data('validator');
		/*立即注册按钮*/
		$("#zy_f_btn").on("click", function () {
			hidetip();
			$("#register").submit();
		});
		/*获取验证码按钮*/
		zyFCode.on("click",function(){
			hidetip();
			if(!$(this).hasClass('btn-code-disable')){
				validateAuthCode();
			}
		});
		/**/
		function validateAuthCode(){
			if(!$("#phone").isValid() || !$("#_vcode").isValid()){
				return;
			}
			countdown();
		}
		/*短信倒计时*/
		function countdown() {
			var time = 120;
			var timer;
			zyFCode.html(time + 's后重新获取').addClass('btn-code-disable');
			timer = setInterval(function () {
				time--;
				zyFCode.html(time + 's后重新获取');
				if (time == 0) {
					clearInterval(timer);
					zyFCode.html('获取验证码').removeClass('btn-code-disable');

				}
			}, 1000);
		}
		/*显示提示信息*/
		function tip(title,input){
			var html = '<span class="zy_f_msg_wrap"><span class="zy_f_icon"></span><span class="zy_f_msg">'+title+'</span></span>';
			$("#"+input).val('');
			$("#"+input).parent().find('.msg-box').css({'display':'block'}).html(html);
			$("#"+input).parent().addClass('n-invalid');
		}
		/*隐藏提示信息*/
		function hidetip(){
			register.find('.n-valid').removeClass('n-invalid');
			register.find('.n-valid').find('.msg-box').css({'display':'none'}).html('');
		}
		/*更换验证码*/
		function changeimg() {
			var myimg = document.getElementById("mem_reg_pic");
			now = new Date();
			myimg.src = "/util/vcode?_vkey=9aa9d11f40088d405802403d8b4675e6" + "&" + now.getTime();                      
			return false;
		}
		$('#zy_f_vcode').on('click', changeimg);  

	});
            // $(function(){
            //    $('#checked-yd').on('click',function(){
            //        $('#checkedChoice').css({'display':'block'});
            //    });
            //    $('#mem_agree_close').on('click',function(){
            //        $('#checkedChoice').css({'display':'none'});
            //    }); 
            //    $('#agree-button').on('click',function(){
            //        $('#checkedChoice').css({'display':'none'});
            //        $('#checked').prop("checked",true);
            //    });                
            // });

</script>